<template>
    <div class="componentChild">
        <p> {{ message }}</p>
    </div>
</template>

<!-- 通过defineProps实现父组件向子组件传值 -->
<script setup lang="ts">
import { ref } from 'vue';
const message = ref('msg from ts component')
const logMessage = () => {
    console.log('ts component child:', message.value)
    console.log('name value:', props.name, props.value)
}

defineExpose({
    logMessage
})

type PassData = {
    name: string,
    value?: string | number
}

// const props = defineProps<PassData>()

// 默认值
const props = withDefaults(defineProps<PassData>(), { value: 123 })


</script>

<style scoped></style>